﻿@model Rockstars
@layout SimpleLayout

@{
    ViewBag.Title = "Page with typed 'Rockstars' model and no C# controller";
    var rockstars = Model.Age.HasValue 
        ? Db.Select<Rockstar>(q => q.Age == Model.Age.Value)
        : Db.Select<Rockstar>();
    var title = Model.Age.HasValue ? "{0} year old rockstars".Fmt(Model.Age) : "All Rockstars";
}

<div id="content-page">
    
    <h2>/Start Partials</h2>
    
    <hr />1. RazorPartial: @Html.Partial("RazorPartial")
    
    <hr />2. NestedRazorPartial: @Html.Partial("NestedRazorPartial")

    <hr />3. MarkdownPartial: @Html.Partial("MarkdownPartial")
    
    <hr />4. RazorPartialModel: @Html.Partial("RazorPartialModel", rockstars)

    <hr />
    <h2>/End Partials</h2>

    <div>@title</div>
    <ul>
        @foreach (var rockstar in rockstars) {
            <li>@rockstar.FirstName - @rockstar.LastName (<a href="?Age=@rockstar.Age">@rockstar.Age</a>)</li>
        }
    </ul>

    <p><a href="?">Show all Rockstars</a></p>

    <h2>Razor View</h2>
    <script src="https://gist.github.com/3162493.js"></script>
 
</div>

<!--view:default.cshtml-->

@ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw()